home *** CD-ROM | disk | FTP | other *** search
- package com.extensibility.app;
-
- import com.extensibility.plugin.api.LoginPanel;
- import java.awt.Container;
- import java.awt.GridBagConstraints;
- import java.awt.GridBagLayout;
- import java.awt.Insets;
- import java.awt.event.ActionListener;
- import javax.swing.JButton;
- import javax.swing.JComboBox;
- import javax.swing.JLabel;
- import javax.swing.JPasswordField;
- import javax.swing.JTextField;
-
- class LoginPanelImpl extends LoginPanel {
- private JLabel lblUserName;
- private JTextField txtUserName;
- private JLabel lblPassword;
- private JPasswordField txtPassword;
- private JComboBox cboSelection;
- private JLabel lblSelection;
- private JButton btnConnect;
-
- public LoginPanelImpl(String[] var1, String var2, String var3, String var4) {
- try {
- this.prepare(var1, var2, var3, var4);
- } catch (Exception var6) {
- ((Throwable)var6).printStackTrace();
- }
-
- }
-
- public String getSelection() {
- Object var1 = this.cboSelection.getSelectedItem();
- return var1.toString();
- }
-
- public String getUserName() {
- return this.txtUserName.getText();
- }
-
- public char[] getPassword() {
- return this.txtPassword.getPassword();
- }
-
- public void setActionListener(ActionListener var1) {
- if (this.btnConnect != null) {
- this.btnConnect.addActionListener(var1);
- }
-
- }
-
- public void setEditSelections(boolean var1) {
- this.cboSelection.setEditable(var1);
- }
-
- private void prepare(String[] var1, String var2, String var3, String var4) {
- GridBagLayout var5 = new GridBagLayout();
- ((Container)this).setLayout(var5);
- this.lblSelection = new JLabel();
- if (var3 != null) {
- this.lblSelection.setText(var3);
- } else {
- this.lblSelection.setText("Instance:");
- }
-
- this.cboSelection = new JComboBox();
- if (var1 != null) {
- for(int var6 = 0; var6 < var1.length; ++var6) {
- this.cboSelection.addItem(var1[var6]);
- }
- }
-
- this.lblUserName = new JLabel();
- this.lblUserName.setText("User Name:");
- this.lblPassword = new JLabel();
- this.lblPassword.setText("Password:");
- this.txtUserName = UI.createTextField();
- if (var2 != null) {
- this.txtUserName.setText(var2);
- }
-
- this.txtPassword = new JPasswordField();
- this.txtPassword.setMargin(new Insets(1, 3, 1, 3));
- this.btnConnect = new JButton();
- if (var4 != null) {
- this.btnConnect.setText(var4);
- } else {
- this.btnConnect.setText("Connect >>>");
- }
-
- GridBagConstraints var7 = new GridBagConstraints();
- var7.insets = new Insets(4, 4, 4, 4);
- var7.gridx = 0;
- var7.gridy = 0;
- var7.gridwidth = 1;
- var7.gridheight = 1;
- var7.anchor = 17;
- var7.fill = 0;
- var7.weightx = (double)0.0F;
- ((Container)this).add(this.lblSelection, var7);
- var7.gridx = 1;
- var7.fill = 2;
- var7.weightx = (double)1.0F;
- ((Container)this).add(this.cboSelection, var7);
- var7.gridx = 0;
- var7.gridy = 1;
- var7.fill = 0;
- var7.weightx = (double)0.0F;
- ((Container)this).add(this.lblUserName, var7);
- var7.gridx = 1;
- var7.weightx = (double)1.0F;
- var7.fill = 2;
- ((Container)this).add(this.txtUserName, var7);
- var7.gridx = 0;
- var7.gridy = 2;
- var7.fill = 0;
- var7.weightx = (double)0.0F;
- ((Container)this).add(this.lblPassword, var7);
- var7.gridx = 1;
- var7.gridy = 2;
- var7.fill = 2;
- var7.weightx = (double)1.0F;
- ((Container)this).add(this.txtPassword, var7);
- var7.gridx = 0;
- var7.gridy = 3;
- var7.gridwidth = 2;
- var7.anchor = 10;
- var7.fill = 0;
- ((Container)this).add(this.btnConnect, var7);
- }
- }
-